<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
// 题目2(必做)：现在两个数组，判断在a中的元素，不在b中 const a = [1,2,3,5] const b=[1,3,5,6] 将在a不在b中的筛选出来
    // 要求：输出一个数组：[2]
    const a = [1, 2, 3, 5]
    const b = [1, 3, 5, 6]
    let c=a
    let c2=[]
   
   b.forEach(item=>{
    for(let i=0; i<c.length; i++) {
        if(item===c[i]){
         c.splice(i,1)
         i--
        }
    }
    })
    console.log(c);

    a.forEach(item=>{
      let p=b.every(item1=>{
        return item!==item1
      })
      if(p)c2.push(item)
    })
    console.log(c2);

    </script>
</body>
</html>